<template>
  <tr>
    <td>
      <input type="checkbox" :checked="checked" @change="changeFn(index)" />
    </td>
    <td>
      {{name}}
    </td>
    <td>
    {{price}}
    </td>
    <td>
      <button  >-</button>
      {{num}}
     <button >+</button>
    </td>
    <td>
      {{num*price}}
    </td>
  
    <td><button @click="delFn(index)">删除</button></td>
  </tr>
</template>

<script>
export default {
  // 通过props 接收父组件的数据
  props: ['name', 'price', 'num', 'checked', 'index'],
 methods:{
  delFn(index){
   this.$emit('del',index)
  },
  changeFn(index){
    this.$emit('change',index)
  }
 },
 
}
</script>

<style></style>